#include "cmd_handle.h"
#include <stdio.h>

int command(); 

#define SIZE_CMD 256
int main(){
	while(1){
		int i =command();
		if(i==-1) printf("输入错误！\n");
		if(i==0) break;
		if(i==1)printf("成功！\n");
	}		
	return 0;
}

int command(){
	printf("bashshel======>");
	char cmd[SIZE_CMD];
	fgets(cmd,sizeof(cmd),stdin);
	cmd[strlen(cmd)-1]='\0';
	if(strlen(cmd)==0)return -1;
	if(strcmp(cmd,"exit")==0)return 0;
	return cmd_exec(cmd);
}
